<template>
  <div>
    search
    <button @click="btn">点击</button>
    <button @click="btn1">点击1</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: true,
      timer:null
    };
  },
  methods: {
    btn() {
      if (this.flag) {
        this.flag = false;
        setTimeout(() => {
          console.log(11111);
          this.flag = true;
        }, 1000);
      }
    },
    btn1() {
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        console.log(11111);
      }, 1000);
    },
  },
};
</script>

<style>
</style>